﻿#region Imports
using System.Windows.Controls;
using System.Windows.Input;
using BookManager.ViewModels;
#endregion Imports

namespace BookManager.Views
{
    /// <summary>
    /// Interaction logic for BookDetailsWindow.xaml
    /// </summary>
    public partial class BookDetailsWindow : UserControl
    {
        #region Constructors
        public BookDetailsWindow()
        {
            InitializeComponent();
        }
        #endregion Constructors

        #region Events
        private void UserControl_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Escape)
            {
                var vm = (MainViewModel)this.DataContext;
                vm.CloseBookDetailsCommand.Execute(vm.SelectedBook);
            }
        }
        #endregion Events
    }
}
